package edu.online.dal;

import edu.online.entity.LessonOrderEntity;
import org.apache.ibatis.jdbc.SQL;

public class LessonOrderEntitySqlProvider {

    public String insertSelective(LessonOrderEntity record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("lessonorder");
        
        if (record.getLessonorderid() != null) {
            sql.VALUES("LessonOrderID", "#{lessonorderid,jdbcType=CHAR}");
        }
        
        if (record.getLessonid() != null) {
            sql.VALUES("LessonID", "#{lessonid,jdbcType=CHAR}");
        }
        
        if (record.getPayinfoid() != null) {
            sql.VALUES("PayInfoID", "#{payinfoid,jdbcType=CHAR}");
        }
        
        if (record.getStudentid() != null) {
            sql.VALUES("StudentId", "#{studentid,jdbcType=CHAR}");
        }
        
        if (record.getAdminuserid() != null) {
            sql.VALUES("AdminUserId", "#{adminuserid,jdbcType=CHAR}");
        }
        
        if (record.getCreatetime() != null) {
            sql.VALUES("CreateTime", "#{createtime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getOrderamount() != null) {
            sql.VALUES("OrderAmount", "#{orderamount,jdbcType=INTEGER}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(LessonOrderEntity record) {
        SQL sql = new SQL();
        sql.UPDATE("lessonorder");
        
        if (record.getLessonid() != null) {
            sql.SET("LessonID = #{lessonid,jdbcType=CHAR}");
        }
        
        if (record.getPayinfoid() != null) {
            sql.SET("PayInfoID = #{payinfoid,jdbcType=CHAR}");
        }
        
        if (record.getStudentid() != null) {
            sql.SET("StudentId = #{studentid,jdbcType=CHAR}");
        }
        
        if (record.getAdminuserid() != null) {
            sql.SET("AdminUserId = #{adminuserid,jdbcType=CHAR}");
        }
        
        if (record.getCreatetime() != null) {
            sql.SET("CreateTime = #{createtime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getOrderamount() != null) {
            sql.SET("OrderAmount = #{orderamount,jdbcType=INTEGER}");
        }
        
        sql.WHERE("LessonOrderID = #{lessonorderid,jdbcType=CHAR}");
        
        return sql.toString();
    }
}